package com.lagou.service.impl;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;

import java.util.concurrent.TimeUnit;

@Service
public class HelloServiceImpl implements HelloService {

    @Override
    public String sayHello(String name, int timeToWait) {
        this.sleep();
        return "hello:"+name;
    }

    @Override
    public String methodA() {
        this.sleep();
        return "hello: A";
    }

    @Override
    public String methodB() {
        this.sleep();
        return "hello: B";
    }

    @Override
    public String methodC() {
        this.sleep();
        return "hello: C";
    }


    private void sleep(){
        try {
            TimeUnit.MILLISECONDS.sleep((long) (101 * Math.random()));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
